<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>活动统计管理</title>
<meta name="decorator" content="default" />
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/static/css/base.css">
<script type="text/javascript">
	$(document).ready(function() {
		$("#btnExport").click(function(){
			var year = $("#zq").find("option:selected").val();
			//document.location.href = "${ctx}/approve/statisticPerson/export?year="+year;
			top.$.jBox.confirm("确认要导出党员积分统计吗？","系统提示",function(v,h,f){
				if(v=="ok"){
					document.location.href = "${ctx}/approve/statisticPerson/export?year="+year;				
					//$("#searchForm").attr("action","${ctx}/approve/statisticPerson/export");
					//$("#searchForm").submit();
					

				}
			},{buttonsFocus:1});
			top.$('.jbox-body .jbox-icon').css('top','55px');
		});
	});
	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}
</script>
</head>
<body>
	<div class="col-xs-6">
		<div class="row-space">
			<div class="e-box float-e-margins" style="height: 370px;">
				<div class="e-box-title">
					<h2>党员积分统计</h2>
				</div>
				<div class="e-box-content">
					<div id="zjtr" style="width: 100%; height: 355px;"></div>
				</div>
			</div>
		</div>
	</div>
	<form:form id="searchForm" modelAttribute="personStatistic"
		action="${ctx}/approve/statisticPerson/" method="post"
		class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
		<input id="pageSize" name="pageSize" type="hidden"
			value="${page.pageSize}" />
		<input type="hidden" id="orgId" value="${orgId}" />
		<input type="hidden" id="typeId" value="${typeId}" />
		<ul class="ul-form">
		<li><label>姓名：</label>
				<form:input path="personname" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li><label>年度：</label> 
			<form:select path="zq" class="input-medium" style="width:80px">
					<form:options items="${fns:findAssessmentTimeList()}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
				</li>
			<li class="btns">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id="btnSubmit" class="btn" type="submit" value="查询" /></li>
				
			<li class="btns"><input id="btnExport" class="btn" type="button" value="导出"/></li>
			
		</ul>
	</form:form>
	<sys:message content="${message}" />
	<table id="contentTable"
		class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>姓名</th>
				<th>年度</th>
				<th>排名</th>
				<th>积分</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${PersonStatisticList}" var="personStatistic">
				<tr>
					<td>${personStatistic.name}</td>
					<td>${personStatistic.year}</td>
					<td>${personStatistic.numPm}</td>
					<td>${personStatistic.totalScore}</td>

						<td>
						<a href="${ctx}/approve/personStatistic/form?personId=${personStatistic.personId}&year=${personStatistic.year}">查看</a>
						<!-- 
						<a href="${ctx}/approve/statisticPerson/form?id=${personStatistic.personId}">查看</a>
						 -->
						</td>
						
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	<script
		src="${pageContext.request.contextPath}/static/js/jquery-1.10.2.js"
		type="text/javascript" charset="utf-8"></script>
	<script
		src="${pageContext.request.contextPath}/static/js/bootstrap.min.js"
		type="text/javascript" charset="utf-8"></script>
	<script
		src="${pageContext.request.contextPath}/static/echarts/echarts.min.js"
		type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		$(function() {
			findPersonStatisticChart();
		});
		var options = {
			title : {
				text : '党员积分排行(前10名)'
			},
			legend : {
				show : false,
				data : [ '党员积分' ]
			},
			xAxis : {
				axisLabel : {
					textStyle : {
						fontSize : 10
					},
					rotate : 0
				},
				data : []
			},
			yAxis : {
				name : '积分',
				axisLabel : {
					textStyle : {
						fontSize : 10
					},
					formatter : function(value, index) {
						return value;
					}
				}
			},
			series : [ {
				name : '姓名',
				type : 'bar',
				barMinHeight : 10,
				label : {
					normal : {
						show : true,
						position : 'top',
						textStyle : {
							fontWeight : 'bold',
							fontSize : 10
						}
					}
				},
				itemStyle : {
					normal : {
						color : function(params) {
							var colorList = [ '#cc3333', '#146ddc', '#f99d41',
												'#67b320', '#cc3333', '#146ddc', '#f99d41','#EFE42A','#EE9201','#B74AE5' ];
							return colorList[params.dataIndex];
						},
						opacity : 0.8
					}
				},
				data : []
			} ]
		};

		//查询前10名党员积分柱状图
		function findPersonStatisticChart() {
			var zq = $("#zq").val();
			$.ajax({
				url : '${ctx}/approve/statisticPerson/findPersonPmList',
				type : "post",
				data : {
					"zq" : zq
				},
				dataType : "json",
				success : function(data) {
					var personName = [];
					var personScore = [];
					for ( var i in data) {
						personName.push(data[i].name);
						personScore.push(data[i].totalScore);
					}
					options.series[0].data = personScore;
					options.xAxis.data = personName;
					var zjtrChart = echarts.init(document
							.getElementById('zjtr'));
					zjtrChart.setOption(options);
				}
			});
		}
	</script>
</body>
</html>